import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'index',
    redirect: '/Home', // 表示父级重定向到哪一个子集 redirect重定向为渲染的路径
    component: () => import('../views/index.vue'),
    children: [{
      path: '/Home',
      name: 'Home',
      component: () => import('../views/Home.vue')
    }, {
      path: '/classify',
      name: 'classify',
      component: () => import('../views/classify.vue')
    }, {
      path: '/person',
      name: 'person',
      component: () => import('../views/person.vue')
    }, {
      path: '/ShoppingCard',
      name: 'ShoppingCard',
      component: () => import('../views/ShoppingCard.vue')
    }, ]
  },
  {
    path: '/goodsList',
    name: 'goodsList',
    component: () => import('../views/goods/goodsList.vue')
  }, {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/detail/detail.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/login.vue')
  },
]

const router = new VueRouter({
  routes
})

export default router